package com.solome.device;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.utils.viewport.*;

/**
 * 适配
 * 
 * @author soells
 *
 */
public abstract class IConfig {
	static public boolean ISDEBUG = true;

	final static public int SCREEN_WIDTH = 640;
	final static public int SCREEN_HEIGHT = 960;

	// 资源目录
	final static public String FONT_RES = "fonts/font.ttf";// 字体目录
	static public IDevice device;
	static public Viewport viewport = new StretchViewport(SCREEN_WIDTH,
			SCREEN_HEIGHT);
	final static public Skin skin = new Skin(
			Gdx.files.internal("data/uiskin.json"));
	static {
		float screenWidth = Gdx.graphics.getWidth();
		float screenHeight = Gdx.graphics.getHeight();
		float visibleSizeWidth = SCREEN_WIDTH;
		float visibleSizeHeight = SCREEN_HEIGHT;

		if (screenWidth / screenHeight > visibleSizeWidth / visibleSizeHeight) {
			visibleSizeWidth = visibleSizeHeight * screenWidth / screenHeight;
		} else if (screenWidth / screenHeight < visibleSizeWidth
				/ visibleSizeHeight) {
			visibleSizeHeight = visibleSizeWidth / (screenWidth / screenHeight);
		}
		viewport = new StretchViewport(visibleSizeWidth, visibleSizeHeight);

		// BitmapFont bitmapFont = FontFactory.getInstance().init("", 15);
		// TextFieldStyle fieldStyle = skin.get(TextFieldStyle.class);
		// fieldStyle.font.dispose();
		// fieldStyle.messageFont.dispose();
		// fieldStyle.font = bitmapFont;
		// fieldStyle.messageFont = bitmapFont;
		//
		// TextButtonStyle style = new TextButtonStyle(
		// skin.get(TextButtonStyle.class));
		// style.font.dispose();
		// style.font = bitmapFont;
		//
		// SelectBoxStyle boxStyle = skin.get(SelectBoxStyle.class);
		// boxStyle.font.dispose();
		// boxStyle.listStyle.font.dispose();
		// boxStyle.font = bitmapFont;
		// boxStyle.listStyle.font = bitmapFont;
		//
		// ListStyle listStyle = skin.get(ListStyle.class);
		// listStyle.font.dispose();
		// listStyle.font = bitmapFont;
	}

	// static {}
}
